# # 第四章函数
#
# # 可变参数，可以传入多个参数
# # def fav(*fr):
# #     print('我喜欢的水果有: ')
# #     for i in fr:
# #         print(i)
# #
# #
# # fav('芒果')
# # fav('苹果','芒果','橘子')
# # fav('西瓜','椰子','草莓','橙子')
#
#
#
# # 参数的值大于2，如果声明函数的时候有其他参通常会把可变长参数放在最后
# # def show(a, b, *l):
# #     print(a)
# #     print(b)
# #     print(l)
# #
# # show(1, 2, 3, 4, 6, 66,)
#
#
# # 可变参数，可以传入多个参数
# # def fav(*fr):
# #     print('我喜欢的水果有: ')
# #     for i in fr:
# #         print(i)
# #
# #
# # fav('芒果')
# # fav('苹果','芒果','橘子')
# # fav('西瓜','椰子','草莓','橙子')
#
#
#
# # 参数的值大于2，如果声明函数的时候有其他参通常会把可变长参数放在最后
# # def show(a, b, *l):
# #     print(a)
# #     print(b)
# #     print(l)
# #
# # show(1, 2, 3, 4, 6, 66,)
#
#
#
#
# # def rectange():
# #     a = int (input('请输入矩形的长（整数值）：'))
# #     b = int (input('请输入矩形的长（整数值）'))
# #     s = a*b
# #     c = 2*(a + b)
# #     print('该矩形的面积为：',s)
# #     print('该矩形的面积为:',c)
# # rectange()
#
#
#
# # def re(a, b, c, d):
# #     return a+b, c*d, a-c
# #
# #
# # ss = re(1, 2, 3, 4)
# # print(ss)
#
#
#
# # def fu():
# #     a = 20
# #     return a
# #
# # a = 1
# # print(a)
# # c = fu()
# # print(c)
#
#
#
# # 利用递归计算100的阶乘
#
# # def f(n):
# #     if n <= 1:
# #         return 1
# #     else:
# #         return n * f(n - 1)
#
#
# # num = int(input('请输入一个整数：'))
# # s = f(num)
# # print(num, '的阶乘是：', s)
#
#
#
#
# # def su(n):
# #     if n == 1:
# #         return 1
# #     else:
# #         return n + su(n - 1)
# #
# #
# # print(su(120))
#
#
#
# # 计算斐波那契数列F（0）=0 F（1）=1，F(n)=F(n-1)+F(n-2)(n>=2)的第n项
# # def fib(n):
# #     if n <= 2:
# #         return 1
# #     else:
# #         return fib(n - 1) + fib(n - 2)
# # print('斐波那契数列的第{}项为{}'.format(12,fib(12)))
#
#
#
# # 使用匿名函数实现a+b+c
# sum = lambda a, b, c: a + b + c
# print(sum(1, 2, 3))
#
#
# # 编写lambda函数，参数为正方形的边长m，输出正方形的面积
# fun = lambda m: m ** 2
# print(fun(5))
